package j2025.j01;

/**
 * @Author 猫大仙
 */
public class j0121 {
    public int uniquePaths(int m, int n) {
        int[][] me = new int[m+1][n+1];
        return dfs(m,n,me);
    }
    public int dfs(int i,int j,int[][] me){
        if(i==1 || j==1){
            me[i][j]=1;
            return  1;
        }
        if(me[i][j]!=0){
            return me[i][j];
        }
        if(i==0 || j==0){
            return 0;
        }
        me[i][j] = dfs(i-1,j,me)+dfs(i,j-1,me);
        return me[i][j];
    }
}
